<template>
  <BasicModal v-bind="$attrs" @register="registerModal" :footer="null" title="详情" width="60%" destroyOnClose>
    <Description :column="1" :data="dataInfo" :schema="formSchema" :labelStyle="{width: '120px'}">
    </Description>
  </BasicModal>
</template>
<script lang="ts" setup>
import { ref, useAttrs } from 'vue';
import { Description, useDescription } from '/@/components/Description/index';
import BasicModal from "/@/components/Modal/src/BasicModal.vue";
import {useModalInner} from "/@/components/Modal";
const emit = defineEmits(['register']);
const attrs = useAttrs();
const dataInfo = ref({});
const  formSchema =    [
  {
    label: '计划编号',
    field: 'no',
  },
  {
    label: '投入品',
    field: 'input_dictText',
  },
  {
    label: '投入品用量',
    field: 'usageAndDosage',
  },
  {
    label: '农事操作',
    field: 'productionOperation_dictText',
  },
  {
    label: '作业内容',
    field: 'operationContent',
  },
  {
    label: '作业要求',
    field: 'operationDescription',
  },
  // {
  //   label: '作业周期',
  //   field: 'jobDuration',
  // },
  // {
  //   label: '作业工艺',
  //   field: 'jobIntroduce',
  // },
  {
    label: '作业开始时间',
    field: 'jobStartTime',
  },
  // {
  //   label: '是否临时安排',
  //   field: 'randomJob_dictText',
  // },
  {
    // todo 需要使用租户用户
    label: '计划操作人',
    field: 'jobby_dictText',
  },
  {
    label: '种植计划',
    field: 'growPlanId_dictText',
  }
]
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
  setModalProps({ confirmLoading: false });
  // console.log(data);
  dataInfo.value = data.record;
  dataInfo.value.jobby_dictText = data.record.sysUsers.map(item => item.realname).join('、')
  dataInfo.value.input_dictText = data.record.inputList.map(item => item.name).join('、')
  // console.log(dataInfo.value);
});
</script>
